function toast(title) {
  wx.showToast({
    title,
    icon: 'none',
    duration: 1500,
    mask: true,
  });
}
function to(url) {
  wx.navigateTo({ url });
}
function log(res) {
  const logger = wx.getRealtimeLogManager();
  logger.info(res);
}
function err(err) {
  const logger = wx.getRealtimeLogManager();
  logger.error(err);
}
function back() {
  setTimeout(() => {
    wx.navigateBack({ delta: 1 });
  }, 1000);
}
function scene(e) {
  const decodeScene = decodeURIComponent(e);
  console.log(decodeScene);
  const params = {};
  decodeScene.split('&').forEach(item => {
    const arr = item.split('=');
    params[arr[0]] = arr[1];
  });
  return params;
}
function get(string) {
  return wx.getStorageSync(string);
}
function set(string, data) {
  wx.setStorageSync(string, data);
}
module.exports = {
  toast,
  to,
  log,
  err,
  back,
  scene,
  get,
  set,
};
